package cn.edu.xmu.wnw.service.impl;

import cn.edu.xmu.wnw.dao.UserDAO;
import cn.edu.xmu.wnw.pojo.User;
import cn.edu.xmu.wnw.service.UserManageService;


public class UserManageServiceImpl implements UserManageService
{

	private UserDAO userDao;

	public String getUserName(int userID)
	{
		User user = userDao.findById(userID);
		if (user == null)
			return null;
		return user.getUsername();
	}

	public boolean createUser(User user)
	{
		try
		{
			userDao.save(user);
			return true;
		}
		catch (Exception e)
		{
			return false;
		}
	}

	public UserDAO getUserDao()
	{
		return userDao;
	}

	public void setUserDao(UserDAO userDao)
	{
		this.userDao = userDao;
	}

}
